import 'dart:convert';
import 'dart:ui';

import 'package:crypto/crypto.dart';

extension StringHCStyle on String {
  String md5Desc() {
    var bytes = utf8.encode(this); // data being hashed
    final md5Str = md5.convert(bytes).toString();
    return md5Str;
  }

  Color toColor() {
    String colorString = substring(1, length);
    if (colorString.length == 6) {
      colorString = "FF$colorString";
    }
    return Color(int.parse(colorString, radix: 16));
  }
}
